<template>
   <!-- 头部部分 -->
    <header class="header">
      <h1>todos</h1>
      <input class="new-todo" placeholder="请输入任务名称" autofocus v-model.trim="sum" @keyup.enter="addbtn"/>
    </header>
</template>
 
<script>
export default {
  props: {},
  data() {
    return {
      sum:""
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    addbtn(){
      if(!this.sum)return alert('sum不能为空')
      this.$emit("addbtn",this.sum)
      this.sum=""
    }
  }
};
</script>

<style scoped>
     
</style>